#ifndef CANOPEN_H
#define CANOPEN_H
#include <QApplication>

#include <linux/can.h>
#include <linux/can/raw.h>




// 定义CANopen相关的宏
#define CANOPEN_SDO_WRITE_REQUEST(node_id) (0x600 + (node_id)) // SDO写请求ID
#define CANOPEN_COB_ID_SDO_RESPONSE 0x580 // 默认 SDO 响应 ID（从站节点 ID 加上基地址）
#define SDO_WRITE_COMMAND 0x23 // SDO写4字节命令
#define CANOPEN_SDO_READ_CMD 0x40


enum{
    WRITE_BYTE_1,
    WRITE_BYTE_2,
    WRITE_BYTE_3,
    WRITE_BYTE_4
};
struct can_frame canopen_sdo_write(uint8_t node_id, uint16_t index, uint8_t subindex, uint32_t data,int type =WRITE_BYTE_4);
struct can_frame canopen_sdo_read(uint8_t node_id, uint16_t index, uint8_t subIndex = 0);
class canopen
{
public:
    canopen();
};

#endif // CANOPEN_H
